<template>
  <el-container style="border: 1px solid #eee; height: 800px;">
<!--    <meta name="referrer" content="no-referrer" />-->
    <el-container>
      <!--    顶部容器-->
      <el-header style="text-align: right; font-size: 12px; margin-top: -5px;">
        <div class="user-info">
          <el-image class="avatar" src="favicon.ico" alt="User Avatar" />
          <span class="username">Sora33</span>
          <button class="logout-btn" @click="logOut">Logout</button>
        </div>
      </el-header>
    </el-container>
  </el-container>
</template>
<script>
import {Message} from "element-ui";
import {logOut} from "@/http/login/get";
import router from "@/router";

export default {
  data() {
    return {
    }
  },
  methods: {
    logOut() {
      Message.error('已退出登陆')
      logOut();
      setTimeout(() => {
        localStorage.removeItem('token'); // 清除本地存储的token
        localStorage.removeItem('menuData'); // 清除权限
        router.push('/'); // 重定向到登录页面
      }, 1000); // 延迟1秒后执行
    }
  }
};
</script>

<style scoped>
.el-header {
  background-color: #f0f0f0;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
.user-info {
  float: right;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 10px;
}
.logout-btn {
  background-color: #3498db;
  color: #fff;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 5px;
  margin-left: 5px;
}
</style>